package com.cn.sl.server.api.system.department.model.dto

import com.cn.sl.server.api.system.department.model.entity.DepartmentEntity
import io.swagger.v3.oas.annotations.media.Schema

@Schema(description = "处室")
data class DepartmentDto(
    @field:Schema(description = "主键")
    val id: Long,
    
    @field:Schema(description = "父级id")
    val parentId: Long?,

    /**
     * 名称
     */
    @field:Schema(description = "名称")
    val name: String,

    /**
     * 说明
     */
    @field:Schema(description = "说明")
    val memo: String?,

    /**
     * 排序
     */
    @field:Schema(description = "排序")
    val sort: Int?,

    /**
     * 层级
     */
    @field:Schema(description = "层级")
    val namePath: List<String>,
) {
    constructor(entity: DepartmentEntity) : this(
        entity.id,
        entity.parentId,
        entity.name,
        entity.memo,
        entity.sort,
        entity.namePath
    )
}
